from Base import Base
from selenium.webdriver.common.by import By
import time


class Page(Base):
    # 输入用户名
    username_loc = {By.ID, 'use'}
    # 输入密码
    password_loc = {By.ID, 'pwd'}
    # 点击登录
    button_loc = {By.ID, 'log'}
    # 搜索框输入小张
    delete_loc = {By.XPATH, '/html/body/div[1]/div[1]/div[2]/div/input'}


    def login(self):
        self.open_url("http://localhost:8080/")
        time.sleep(5)
        self.send_keys(self.username_loc, '张三')
        time.sleep(5)
        self.send_keys(self.password_loc, '12345678')
        time.sleep(5)
        self.click(self.button_loc)
        time.sleep(5)
        self.click(self.delete_loc)
        time.sleep(5)

